package wwy.Controller;

import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.*;
import wwy.Common.LogicController;
import wwy.Dao.FoodsDao;
import wwy.Dto.FoodsDto;
import wwy.Service.FoodsService;
import wwy.entity.Foods;

import java.util.List;

@RestController
@Tag(name = "食物")
@RequestMapping("/foods")
@RefreshScope
public class FoodsController extends LogicController<FoodsService, FoodsDao, Foods,Long> {
    public FoodsController(FoodsService service) {super(service);}
    @PostMapping("/getMerchantFoods/{merchantId}")
    public List<FoodsDto> getMerchantFoods(@PathVariable("merchantId") Long merchantId){
        return service.getFoodsByMerchantId(merchantId);
    }
    @GetMapping("/getFoods/{Merchant_id}/{Food_name}")
    public FoodsDto getFood(@PathVariable("Merchant_id") Long Merchant_id, @PathVariable("Food_name") String Foods_name){
        return service.getFood(Merchant_id,Foods_name);
    }
}
